import service from '@/utils/request'
import {ApiResponse,ListApiResponse} from '@/store/dataType.ts'

// BPM 流程监听器 VO
export interface ProcessExpressionVO {
  id: number // 编号
  name: string // 表达式名字
  enabled: boolean // 表达式状态
  expression: string // 表达式值
}

// BPM 流程监听器 API
export const API_BPMN_PROCESS_EXPRESSION = {
  // 查询流程表达式分页
  getProcessExpressionPage: async (params: any):Promise<ListApiResponse> => {
    return await service.get( `/workflow/process-expression/list`,{ params })
  },

  // 查询流程表达式详情
  getProcessExpression: async (id: number):Promise<ApiResponse> => {
    return await service.get(`/workflow/process-expression/` + id )
  },

  // 新增流程表达式
  createProcessExpression: async (data: ProcessExpressionVO):Promise<ApiResponse> => {
    return await service.post(`/bpm/process-expression/create`, data )
  },

  // 修改流程表达式
  updateProcessExpression: async (data: ProcessExpressionVO):Promise<ApiResponse> => {
    return await service.put(`/bpm/process-expression/update`, data )
  },

  // 删除流程表达式
  deleteProcessExpression: async (id: number):Promise<ApiResponse> => {
    return await service.delete(`/bpm/process-expression/delete/` + id )
  }
}